home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
G-Games
/
(c)gd.d64
/
startrek.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
205 lines
10 REM:""************ STARTREK ***********
20 REM:""* MODIFIED FOR THE COMMODORE 64 *
30 REM:""** BY D. HALL JANUARY 1983 **
40 POKE53280,0:POKE53281,0:PRINT"[155]"
50 DIMD$(6):D$(1)="WARP ENGINES":D$(2)="SCANNERS":D$(3)="PHASER BANKS"
60 D$(4)="TORPEDO TUBES":D$(5)="SHIELD CONTROL":D$(6)="COMPUTER"
70 DIMG%(8,8),C$(6),C%(9,2),D%(6),K%(3,3),Q%(8,8)
80 FORI=1TOVAL(RIGHT$(TI$,2)):R=RND(1):NEXT
90 DEFFNA(X)=INT(X*RND(1)+1):T0%=(FNA(20)+20)*10:T%=T0%:E%=3000:P%=15:S%=0
100 PRINT"[147]"SPC(10)"[159]*** STARTREK ***"
105 PRINT"YOUR MISSION - DESTROY THE KLINGONS"
106 PRINT" WITHIN THE TIME SET BY FEDERATION"
107 PRINT" CHECK WITH YOUR ONBOARD COMPUTER"
108 PRINT" GOOD-LUCK, CAPTAIN "
110 X$="[176][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][174]
120 Y$[178]"/>>>>>>>>>>>>>>>>>>>>>>>>EXP
130 W$="
140 [150][165]D(D)[178][186]((K%(I,1)[171]S1)[174]2[170](K%(I,2)[171]S2)[174]2):Q1[178][165]A(8):Q2[178]Q1:S1[178]Q1:S2[178]Q1
160 [140]:[131]1,-1,1,0,1,1,0,-1,0,0,0,1,-1,-1,-1,0,-1,1
170 [129]I[178]1[164]9:[129]J[178]1[164]2:[135]C%(I,J):[130]J,I
180 [129]I[178]1[164]6:D%(I)[178]0:[130]I
210 B9%[178]0:K9%[178]0:[129]I[178]1[164]8:[129]J[178]1[164]8:K3%[178]0:B3%[178]0:[139] [187](1)[179].8[167]270
250 K3%[178][165]A(3):K9%[178]K9%[170]K3%
270 [139][187](1)[179].96[167]300
280 B3%[178]1:B9%[178]B9%[170]1
300 S3%[178][165]A(5):G%(I,J)[178]K3%[172]100[170]B3%[172]10[170]S3%:[130]J,I
340 [139] K9%[178]0[176]B9%[178]0[167]210
360 [139]Q1[177][178]1[167]380
370 S1[178]1:Q1[178]1
380 [139]Q1[179][178]8[167]400
390 S1[178]8:Q1[178]8
400 [139]Q2[177][178]1[167]420
410 S2[178]1:Q2[178]1
420 [139]Q2[179][178]8[167]440
430 S2[178]8:Q2[178]8
440 K3%[178]G%(Q1,Q2)[173]100:B3%[178](G%(Q1,Q2)[173]100[171]K3%)[172]10:S3%[178]G%(Q1,Q2)[171]B3%[172]10[171]K3%[172]100
520 [129]I[178]1[164]3:[129]J[178]1[164]3:K%(I,J)[178]0:[130]J,I
530 [129]I[178]1[164]8:[129]J[178]1[164]8:Q%(I,J)[178]0:[130]J,I
540 Q%(S1,S2)[178]1:[139]K3%[178]0[167]620
560 [129]I[178]1[164]K3%:[141]3500
570 Q%(R1,R2)[178]2:K%(I,1)[178]R1:K%(I,2)[178]R2:K%(I,3)[178]200:[130]
620 [139]B3%[178]0[167]650
630 [141]3500
640 Q%(R1,R2)[178]4
650 [129]I[178]1[164]S3%:[141]3500
670 Q%(R1,R2)[178]3:[130]
690 [141]2600
700 [153]W$;:[133]"SYSCOMMAND:LIST";A%:[153]W$ "
710 PRINTW$" "
711 FORI=1TO9:PRINTSPC(14)" ":NEXT:PRINTW$
715 IFA%<0ORA%>6THEN700
720 IFA%<1ORA%>5THEN780
730 R1=A%+1:IFD%(R1)>=0THEN780
760 PRINTSPC(14)D$(R1):PRINTSPC(14)"NOT OPERATIONAL.":GOTO700
780 ONA%+1GOTO890,1520,1640,1800,2200,3010,3550
890 PRINTSPC(14);:INPUT"COURSE (1-9):";C1:IFC1<1ORC1>9THEN700
920 PRINTSPC(14);:INPUT"WARP FACTOR (1-64):";W1%:IF W1%<=0ORW1%>64THEN700
950 IFD%(1)>=0ORW1%<=4THEN980
960 PRINTSPC(14)"ENGINES ARE DAMAGED;
965 [153][166]14)"MAX. SPEED IS WARP 4.":[137]920
980 [139]E%[171]W1%[177]0[167]1030
990 [139]S%[179]1[167]2470
1000 [153][166]14)"YOU HAVE ONLY"E%"UNITS.":[153][166]14)"I SUGGEST CROSS-CIRCUIT
1010 PRINTSPC(14)"FROM SHIELDS WHICH HAVE":PRINTSPC(14)S%"UNITS.":GOTO700
1030 FORI=1TO6:IFD%(I)>=0THEN1060
1050 D%(I)=D%(I)+1
1060 NEXT
1070 IFFNA(10)<=9THEN1074
1072 GOSUB1080
1074 IFW1%<16THEN1120
1076 GOSUB1080
1078 GOTO1120
1080 R=FNA(6):D%(R)=D%(R)-FNA(5)
1110 PRINTSPC(14)"DAMAGE CONTROL REPORTS ":PRINTSPC(14)D$(R)" DAMAGED.":RETURN
1120 Q%(S1,S2)=0:X=S1:Y=S2:X1%=C%(C1,1):X2%=C%(C1,2)
1190 FORI=1TOW1%:S1=S1+X1%:S2=S2+X2%:IFS1<1ORS1>8ORS2<1ORS2>8THEN1360
1230 IF Q%(S1,S2)=0THEN1270
1240 S1=S1-X1%:S2=S2-X2%:GOTO1280
1270 NEXT
1280 Q%(S1,S2)=1:E%=E%-W1%:IFW1%<8THEN690
1340 T%=T%+1:IFT%>T0%+30THEN2500
1350 GOTO690
1360 X=Q1*8+X+X1%*W1%:Y=Q2*8+Y+X2%*W1%
1380 Q1=INT(X/8):Q2=INT(Y/8):S1=INT(X-Q1*8+.5):S2=INT(Y-Q2*8+.5)
1420 IFS1>0THEN1450
1430 Q1=Q1-1:S1=8
1450 IFS2>0THEN1480
1460 Q2=Q2-1:S2=8
1480 T%=T%+1:E%=E%-W1%+5:IF T%>T0%+30THEN2500
1510 GOTO360
1520 PRINT"[154] SCANNER [146]"
1530 PRINT"[176][192][192][192][178][192][192][192][178][192][192][192][174]":FORI=Q1-1TOQ1+1:FORJ=Q2-1TOQ2+1
1550 IFI<1ORI>8ORJ<1ORJ>8THEN1588
1570 N$=STR$(G%(I,J)):M=LEN(N$)-1:N$=RIGHT$(N$,M):IFM=1THENN$="00"+N$:GOTO1590
1586 IFM=2THENN$="0"+N$:GOTO1590
1587 IFM=3THENN$=N$:GOTO1590
1588 N$="000"
1590 PRINT"[221]"N$;:NEXTJ
1600 PRINT"[221]":PRINT"[171][192][192][192][219][192][192][192][219][192][192][192][179]":NEXTI
1610 PRINT"[145][173][192][192][192][177][192][192][192][177][192][192][192][189]":PRINT" LONG RANGE[155]":GOTO700
1640 IFK3%=0THEN2350
1650 PRINTRIGHT$(W$,14)"ENERGY AVAILABLE="E%
1660 PRINTSPC(14):INPUT"NUMBER TO FIRE:";X%:IFX%<1THEN700
1690 IFE%-X%<0THEN1660
1710 E%=E%-X%:FORI=1TO3:IFK%(I,3)=0THEN1780
1730 H%=X%/K3%/(FND(D)):K%(I,3)=K%(I,3)-H%:PRINTSPC(13)H%"UNIT HIT ON KLINGON
1760 [139]K%(I,3)[177]0[167]1780
1770 [141]2020
1780 [130]
1790 [137]2080
1800 [139]P%[177]0[167]1830
1810 [153][166]14)"ALL TORPEDOES EXPENDED.":[137]700
1830 [153][166]14):[133]"TORPEDO COURSE (1-9):";C1:[139]C1[179]1[176]C1[177]9[167]700
1870 X1%[178]C%(C1,1):X2%[178]C%(C1,2):X[178]S1:Y[178]S2:P%[178]P%[171]1
1930 X[178]X[170]X1%:Y[178]Y[170]X2%:[139]X[179]1[176]X[177]8[176]Y[179]1[176]Y[177]8[167]2180
1960 [139]Q%([181](X),[181](Y))[178]0[167]1930
1980 [129] I[178]1[164]3:[139][181](X)[178]K%(I,1)[175][181](Y)[178]K%(I,2)[167]2075
1990 [130]
2010 [137]2120
2020 R1[178]K%(I,1):R2[178]K%(I,2):K%(I,3)[178]0:Q%(R1,R2)[178]0:G%(Q1,Q2)[178]G%(Q1,Q2)[171]100
2030 [153][166]14)"OPEN***KLINGON DESTROYED***LISTWAIT":K3%[178]K3%[171]1:K9%[178]K9%[171]1:[139]K9%[178]0[167]2560
2050 [139][165]D(D)[177][178]6[176]A%[178]2[137]2070
2060 H%[178](6[171][165]D(D))[172]18:S%[178]S%[171]H%:[153][166]14)"CLR";H%"CMD URGS PHOTON FEEDBACKLIST"
2065 [139]S%[179]0[167]2440
2070 [142]
2075 [141]2020
2080 [141]2370
2090 [141]2600
2100 [137]700
2120 [139]Q%(X,Y)[179][177]3[167]2150
2130 [153][166]14)"YOU CAN'T DESTROY STARS!":[137]2180
2150 [153]"LOAD ***STARBASE DESTROYED***
2160 PRINT" YOU ARE HEREBY RELIEVED OF DUTY!!":GOTO2530
2180 PRINTSPC(14)"TORPEDO MISSED.":GOTO2080
2200 PRINTSPC(14)"ENERGY AVAILABLE="E%+S%
2210 PRINTSPC(14);:INPUT"ENERGY TO SHIELDS:";X%:IFX%<0THEN700
2240 IFE%+S%-X%<0THEN2210
2250 E%=E%+S%-X%:S%=X%:GOSUB2600
2260 GOTO700
2280 PRINTSPC(16)"DEVICE STATUS
2285 [153][166]16)"VALVALVALVALVALVALCLOSECLOSECLOSECLOSECLOSECLOSECLOSECLOSECLOSECLOSEVALVALVALVALVALVAL
2320 FORR1=1TO6:PRINTSPC(16)D$(R1)TAB(31)D%(R1):NEXT
2340 GOTO700
2350 PRINTSPC(14)"SENSORS REPORT NO
2351 [153][166]14)"KLINGONS IN QUADRANT.":[137]700
2370 [139]C$[178]"DOCKED"[167]2460
2380 [139]K3%[178]0[167]2460
2390 [129]I[178]1[164]3:[139]K%(I,3)[178]0[167]2450
2410 H%[178]K%(I,3)[173]([165]D(D)):S%[178]S%[171]H%:[153][166]13)H%"UNIT HIT ON STARSHIP
2440 IFS%<0THENPRINT"[147] FATAL ERROR!! WITH NO SHIELDS":GOTO2520
2450 NEXT
2460 RETURN
2470 PRINT"[147] ***FATAL ERROR***"
2480 PRINT"THE ENTERPRISE IS DEAD IN SPACE AND MUSTBE EVACUATED!":GOTO2530
2500 PRINT"[147]"SPC(5)"TOO LATE!! IT IS STARDATE"T%"!":GOTO2530
2520 PRINT" THE ENTERPRISE HAS BEEN DESTROYED!
2530 [153]" THE FEDERATION WILL BE CONQUERED"
2540 [153]" BY THE INVADING KLINGON BATTLE FLEET":[137]3560
2560 [153]"LOAD THE LAST KLINGON BATTLE CRUISER "
2570 [153]" HAS BEEN DESTROYED!! "
2580 [153]" THE FEDERATION HAS BEEN SAVED!! ":[137]3560
2600 [129]I[178]S1[171]1[164]S1[170]1:[129]J[178]S2[171]1[164]S2[170]1
2620 [139]I[179]1[176]I[177]8[176]J[179]1[176]J[177]8[167]2640
2630 [139]Q%(I,J)[178]4[167]2670
2640 [130]J,I:[137]2730
2670 C$[178]"DOCKED":E%[178]3000:P%[178]15:[129]I[178]1[164]6:D%(I)[178]0:[130]
2710 S%[178]0:[137]2810
2730 [139]K3%[177]0[167]2780
2750 [139] E%[179]300[167]2800
2760 C$[178]"GREENWAIT":[137]2810
2780 C$[178]"*RED*WAIT":[137]2810
2800 C$[178]"SYSYELLOWWAIT"
2810 [153][200](W$,17);" "
2820 [153]"CONT QUADRANT "[199](Q1[170]64)Q2:[153]"LIST"X$:L%[178]0:[141]3330
2840 [141]3330
2860 [153][166]26)"ONCLRSTARDATE"T%:[141]3330
2880 [153][166]26)"ONSYSSTATUS "C$:[141]3330
2900 [153][166]26)"ONCONTENERGY"E%:[141]3330
2920 [153][166]26)"ONFORTORPEDOES"P%:[141]3330
2940 [153][166]26)"ONVERIFYSHIELDS"S%:[141]3330
2960 [153][166]26)"ONDEFKLINGONS"K9%:[141]3330
2980 [153]Y$:[142]
3010 [153][166]14)"SYSCOMPUTER ACTIVE AND
3015 PRINTSPC(14)"AWAITING COMMAND."W$;:INPUT"COMMAND:[155]";A%
3020 PRINTW$" "
3025 FORI=1TO8:PRINTSPC(14)" ":NEXT:PRINTW$
3029 IFA%<1ORA%>3THEN3010
3030 ONA%GOTO2280,3310,3580
3310 GOSUB2600
3320 GOTO700
3330 L%=L%+1:PRINT"[155][171]";:FORI=1TO8:Z$="[155][219][219][219][155]<*>[155]***[155][219][159]+[155][219][215]*[215][155]"
3370 PRINT""MID$(Z$,Q%(L%,I)*5+1,5);:NEXT
3390 PRINT"[179][146] "
3410 RETURN
3500 R1=FNA(8):R2=FNA(8)
3510 IFQ%(R1,R2)<>0THEN3500
3540 RETURN
3550 PRINT"[147]"LEFT$(W$,12)"YOUR RESIGNATION HAS BEEN ACCEPTED!
3560 [133]"ANOTHER GAME";A$:[139] A$[178]"Y"[137]80
3570 [153]"OK. IT WAS GREAT COMPUTING FOR YOU!":[128]
3580 [153][166]14)"MISSION MUST BE COMPLETED
3590 PRINTSPC(14)"WITHIN"T0%+30-T%"STARDATES":GOTO700
4001 002002
6005 003001